import time

from selenium.webdriver.common.by import By

from page_objects.common_page import CommonPage


class MediaDetailsPage(CommonPage):
    save_button = (By.CLASS_NAME, "save")
    list_name_loc = (By.XPATH, '//span[text()="动作片"]/../input')
    close_icon_loc = (By.CSS_SELECTOR, '[data-icon="close"]')

    def click_save_button(self):
        time.sleep(1)
        self.click(*self.save_button)

    # 点击复选框
    def click_list_name(self):
        playlist_name = self.find_ele(*self.list_name_loc)
        if playlist_name.is_selected():
            pass
        else:
            self.click(*self.list_name_loc)

    def click_close_icon(self):
        self.click(*self.close_icon_loc)
